using System;
using System.IO;
using UnityEngine;
using Voodoo.Sauce.Internal.CrossPromo.Models;

namespace Voodoo.Sauce.Internal.CrossPromo.Utils
{
	internal static class PlayerPrefsUtils
	{
		public static string GetKey(string filePath)
		{
			return CacheManager.GetCurrentDirectory(filePath) + Path.GetFileName(filePath);
		}

		public static AssetModel GetAsset(string key)
		{
			try
			{
				return JsonUtility.FromJson<AssetModel>(PlayerPrefs.GetString(key));
			}
			catch (Exception)
			{
				return null;
			}
		}
	}
}
